/*
 * Copyright (c) 2025, 大连理工大学 (Dalian University of Technology)
 *
 * Licensed under the Mulan PSL v2.
 * You can use this file according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of the License at
 *
 *     http://license.coscl.org.cn/MulanPSL2
 *
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. SEE THE MULAN PSL v2
 * FOR MORE DETAILS.
 */

/*
 * @Author: qiulin 1746365080@qq.com
 * @Date: 2024-11-04 09:17:16
 * @LastEditors: qiulin 1746365080@qq.com
 * @LastEditTime: 2024-11-06 14:04:06
 * @FilePath: /SGSim/DBManager/Repository/HDF5/Input/Material/ThermalMaterialRepository.h
 */

#pragma once

#include "highfive/H5File.hpp"

#include "DBManager/IRepository/Input/Material/IThermalMaterialRepository.h"
#include "DBManager/Repository/HDF5/Base/SingleRepositoryBase.h"

template <>
inline HighFive::DataType HighFive::create_datatype<SG::DataStructure::FEM::ThermalMaterial> ()
{
    HighFive::CompoundType compoundType = { { "MID", HighFive::create_datatype<SG::DataStructure::Common::I64> () },
                                            { "K", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
                                            { "CP", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
                                            { "RHO", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
                                            { "H", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
                                            { "MU", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
                                            { "HGEN", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
                                            { "REFENTH", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
                                            { "TCH", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
                                            { "TDELTA", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
                                            { "QLAT", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
                                            { "DOMAIN_ID", HighFive::create_datatype<SG::DataStructure::Common::I64> () } };
    return compoundType;
}

SG_DBMANAGER_HDF5_NAMESPACE_OPEN
class ThermalMaterialRepository : public IThermalMaterialRepository, public SingleRepositoryBase<SG::DataStructure::FEM::ThermalMaterial>
{
  public:
    explicit ThermalMaterialRepository (HDF5Database& database);

    void InitialDatasetInfo () override;
};
SG_DBMANAGER_HDF5_NAMESPACE_CLOSE